<!DOCTYPE html>
<html>
  <head>
    <title>登录</title>
    <meta charset="UTF-8">
	<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
	<link rel="stylesheet" type="text/css" href="css/style.css">
	<style type="text/css">
		body{
			
			background:url(images/bg01.jpg) no-repeat;
			background-size: 100%;
			
		}
		#login{
			width: 300px;
			margin:auto;
			margin-top:15%;
			border:1px solid #fff;
			display: relative;
			
		}

		.panel-footer button{
			margin-left: 200px;
		}
	</style>
  </head>
  <body>
   <div id="login" class="panel panel-default">
  		<form role="form"  class="panel-body">
	    	<div class="form-group">
		    	<label>用户名：</label>
		    	<input type="text" class="from-control" id="username">
		    </div>
		    <div class="form-group">
		    	<label>密    码: &nbsp;&nbsp;&nbsp;&nbsp;</label>
		    	<input type="password" class="from-control" id="password">
		    </div>
	    </form>
	    <div class="panel-footer">
	    	<button type="button" class="btn btn-default" onclick="login()">登录</button>
	    </div>
  	</div>
    <script src="js/jquery-3.2.1.min.js"></script>
	<script src="js/bootstrap.min.js"></script>
	<script type="text/javascript">
		function login(){
			var username=$("#username").val();
			var password=$("#password").val();
			$.ajax({
				url : '/ClothesShopPOS/log/login',
				type : "post",
				cache : false,
				data:{
					username:username,
					password:password
				},
				success : function(data) {
					console.log(data);
					data=JSON.parse(data);
					if (data.statusCode=='0'){
				    	 window.location.href="storehouse.html";
				    }else{
				    	 alert(data.result);
				    }
				}
			})
		}
		
	</script>
  </body>
</html>
